<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html 
     PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <title>Module: Spec::Story::Extensions::Main</title>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <meta http-equiv="Content-Script-Type" content="text/javascript" />
  <link rel="stylesheet" href="../../../.././rdoc-style.css" type="text/css" media="screen" />
  <script type="text/javascript">
  // <![CDATA[

  function popupCode( url ) {
    window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
  }

  function toggleCode( id ) {
    if ( document.getElementById )
      elem = document.getElementById( id );
    else if ( document.all )
      elem = eval( "document.all." + id );
    else
      return false;

    elemStyle = elem.style;
    
    if ( elemStyle.display != "block" ) {
      elemStyle.display = "block"
    } else {
      elemStyle.display = "none"
    }

    return true;
  }
  
  // Make codeblocks hidden by default
  document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
  
  // ]]>
  </script>

</head>
<body>



    <div id="classHeader">
        <table class="header-table">
        <tr class="top-aligned-row">
          <td><strong>Module</strong></td>
          <td class="class-name-in-header">Spec::Story::Extensions::Main</td>
        </tr>
        <tr class="top-aligned-row">
            <td><strong>In:</strong></td>
            <td>
                <a href="../../../../files/vendor/plugins/rspec/lib/spec/story/extensions/main_rb.html">
                vendor/plugins/rspec/lib/spec/story/extensions/main.rb
                </a>
        <br />
            </td>
        </tr>

        </table>
    </div>
  <!-- banner header -->

  <div id="bodyContent">



  <div id="contextContent">



   </div>

    <div id="method-list">
      <h3 class="section-bar">Methods</h3>

      <div class="name-list">
      <a href="#M000020">Story</a>&nbsp;&nbsp;
      <a href="#M000021">run_story</a>&nbsp;&nbsp;
      <a href="#M000022">steps_for</a>&nbsp;&nbsp;
      <a href="#M000023">with_steps_for</a>&nbsp;&nbsp;
      </div>
    </div>

  </div>


    <!-- if includes -->

    <div id="section">

    <div id="class-list">
      <h3 class="section-bar">Classes and Modules</h3>

      Module <a href="Main/StoryRunnerStepGroupAdapter.html" class="link">Spec::Story::Extensions::Main::StoryRunnerStepGroupAdapter</a><br />

    </div>




      


    <!-- if method_list -->
    <div id="methods">
      <h3 class="section-bar">Public Instance methods</h3>

      <div id="method-M000020" class="method-detail">
        <a name="M000020"></a>

        <div class="method-heading">
          <a href="#M000020" class="method-signature">
          <span class="method-name">Story</span><span class="method-args">(title, narrative, params = {}, &amp;body)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000020-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000020-source">
<pre>
   <span class="ruby-comment cmt"># File vendor/plugins/rspec/lib/spec/story/extensions/main.rb, line 5</span>
5:         <span class="ruby-keyword kw">def</span> <span class="ruby-constant">Story</span>(<span class="ruby-identifier">title</span>, <span class="ruby-identifier">narrative</span>, <span class="ruby-identifier">params</span> = {}, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">body</span>)
6:           <span class="ruby-operator">::</span><span class="ruby-constant">Spec</span><span class="ruby-operator">::</span><span class="ruby-constant">Story</span><span class="ruby-operator">::</span><span class="ruby-constant">Runner</span>.<span class="ruby-identifier">story_runner</span>.<span class="ruby-constant">Story</span>(<span class="ruby-identifier">title</span>, <span class="ruby-identifier">narrative</span>, <span class="ruby-identifier">params</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">body</span>)
7:         <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000021" class="method-detail">
        <a name="M000021"></a>

        <div class="method-heading">
          <a href="#M000021" class="method-signature">
          <span class="method-name">run_story</span><span class="method-args">(*args, &amp;block)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Calling this deprecated is silly, since it hasn&#8216;t been released yet.
But, for those who are reading this - this will be deleted before the 1.1
release.
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000021-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000021-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/plugins/rspec/lib/spec/story/extensions/main.rb, line 11</span>
11:         <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">run_story</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">args</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)
12:           <span class="ruby-identifier">runner</span> = <span class="ruby-constant">Spec</span><span class="ruby-operator">::</span><span class="ruby-constant">Story</span><span class="ruby-operator">::</span><span class="ruby-constant">Runner</span><span class="ruby-operator">::</span><span class="ruby-constant">PlainTextStoryRunner</span>.<span class="ruby-identifier">new</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">args</span>)
13:           <span class="ruby-identifier">runner</span>.<span class="ruby-identifier">instance_eval</span>(<span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">block</span>
14:           <span class="ruby-identifier">runner</span>.<span class="ruby-identifier">run</span>
15:         <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000022" class="method-detail">
        <a name="M000022"></a>

        <div class="method-heading">
          <a href="#M000022" class="method-signature">
          <span class="method-name">steps_for</span><span class="method-args">(tag, &amp;block)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Creates (or appends to an existing) a namespaced group of steps for use in
Stories
</p>
<h2>Examples</h2>
<pre>
  # Creating a new group
  steps_for :forms do
    When(&quot;user enters $value in the $field field&quot;) do ... end
    When(&quot;user submits the $form form&quot;) do ... end
  end
</pre>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000022-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000022-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/plugins/rspec/lib/spec/story/extensions/main.rb, line 26</span>
26:         <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">steps_for</span>(<span class="ruby-identifier">tag</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)
27:           <span class="ruby-identifier">steps</span> = <span class="ruby-identifier">rspec_story_steps</span>[<span class="ruby-identifier">tag</span>]
28:           <span class="ruby-identifier">steps</span>.<span class="ruby-identifier">instance_eval</span>(<span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">block</span>
29:           <span class="ruby-identifier">steps</span>
30:         <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000023" class="method-detail">
        <a name="M000023"></a>

        <div class="method-heading">
          <a href="#M000023" class="method-signature">
          <span class="method-name">with_steps_for</span><span class="method-args">(*tags, &amp;block)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Creates a context for running a Plain Text <a
href="Main.html#M000020">Story</a> with specific groups of Steps. Also
supports adding arbitrary steps that will only be accessible to the <a
href="Main.html#M000020">Story</a> being run.
</p>
<h2>Examples</h2>
<pre>
  # Run a Story with one group of steps
  with_steps_for :checking_accounts do
    run File.dirname(__FILE__) + &quot;/withdraw_cash&quot;
  end

  # Run a Story, adding steps that are only available for this Story
  with_steps_for :accounts do
    Given &quot;user is logged in as account administrator&quot;
    run File.dirname(__FILE__) + &quot;/reconcile_accounts&quot;
  end

  # Run a Story with steps from two groups
  with_steps_for :checking_accounts, :savings_accounts do
    run File.dirname(__FILE__) + &quot;/transfer_money&quot;
  end

  # Run a Story with a specific Story extension
  with_steps_for :login, :navigation do
    run File.dirname(__FILE__) + &quot;/user_changes_password&quot;, :type =&gt; RailsStory
  end
</pre>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000023-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000023-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/plugins/rspec/lib/spec/story/extensions/main.rb, line 58</span>
58:         <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">with_steps_for</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">tags</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)
59:           <span class="ruby-identifier">steps</span> = <span class="ruby-constant">Spec</span><span class="ruby-operator">::</span><span class="ruby-constant">Story</span><span class="ruby-operator">::</span><span class="ruby-constant">StepGroup</span>.<span class="ruby-identifier">new</span> <span class="ruby-keyword kw">do</span>
60:             <span class="ruby-identifier">extend</span> <span class="ruby-constant">StoryRunnerStepGroupAdapter</span>
61:           <span class="ruby-keyword kw">end</span>
62:           <span class="ruby-identifier">tags</span>.<span class="ruby-identifier">each</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">tag</span><span class="ruby-operator">|</span> <span class="ruby-identifier">steps</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">rspec_story_steps</span>[<span class="ruby-identifier">tag</span>]}
63:           <span class="ruby-identifier">steps</span>.<span class="ruby-identifier">instance_eval</span>(<span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">block</span>
64:           <span class="ruby-identifier">steps</span>
65:         <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>


    </div>


  </div>


<div id="validator-badges">
  <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>

</body>
</html>